<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./assets/layui/css/layui.css" />
  </head>
  <body>
    <div class="layui-container">
      <div id="countDown"></div>
    </div>

    <script src="./assets/layui/layui.js"></script>
    <script>
      layui.use(["util"], function () {
        var util = layui.util;
        // 倒计时
        var endTime = new Date("2021/06/11").getTime();
        var serverTime = new Date().getTime();
        util.countdown(endTime, serverTime, function (date, serverTime, timer) {
          var str = date[0] + "天" + date[1] + "时" + date[2] + "分" + date[3] + "秒";
          layui.$("#countDown").html("距离2021/06/11还有：" + str);
          // clearTimeout(timer);
        });
      });
    </script>
  </body>
</html>
